import 'package:k3cloud_api/params/request_param.dart';

/// it is used to build parameters to request the submit interface.
class SubmitParam extends RequestParam {
  @override
  String getRequestPath() {
    return "DynamicFormService.Submit";
  }

  @override
  Map<String, dynamic> toJson() {
    Map<String, dynamic> data = {};
    if (createOrgId != null) data["createOrgId"] = createOrgId;
    if (numbers != null) data["numbers"] = numbers;
    if (ids != null) data["ids"] = ids;
    if (networkCtrl != null) data["networkCtrl"] = networkCtrl;
    if (selectedPostId != null) data["selectedPostId"] = selectedPostId;

    Map<String, dynamic> json = {};
    if (formId != null) json["formId"] = formId;
    json["data"] = data;
    return json;
  }

  String? formId;
  int? createOrgId;
  List<String>? numbers;
  String? ids;
  bool? networkCtrl;
  int? selectedPostId;

  static _Builder builder() {
    return _Builder();
  }
}

class _Builder {
  final SubmitParam _param = SubmitParam();

  SubmitParam build() => _param;
  
  _Builder formId(String formId) {
    _param.formId = formId;
    return this;
  }

  _Builder createOrgId(int createOrgId) {
    _param.createOrgId = createOrgId;
    return this;
  }

  _Builder numbers(List<String> numbers) {
    _param.numbers = numbers;
    return this;
  }

  _Builder ids(List<int> ids) {
    _param.ids = ids.join(",");
    return this;
  }

  _Builder networkCtrl(bool networkCtrl) {
    _param.networkCtrl = networkCtrl;
    return this;
  }

  _Builder selectedPostId(int selectedPostId) {
    _param.selectedPostId = selectedPostId;
    return this;
  }
}